package com.xin.di.uav.applet.rest;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xin.di.uav.applet.po.PricingRule;
import com.xin.di.uav.applet.service.IPricingRuleService;
import com.xin.di.uav.common.request.pricing.PricingAddRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.util.List;

/**
 * <p>
 * 定价规则表 前端控制器
 * </p>
 *
 * @author LTQ
 * @since 2023-11-14
 */
@Controller
public class PricingRuleRest {
    @Autowired
    private IPricingRuleService iPricingRuleService;

    public void add(PricingAddRequest pricingAddRequest) {
        iPricingRuleService.add(pricingAddRequest);
    }

    public void insert(PricingRule pricingRule) {
        iPricingRuleService.save(pricingRule);
    }

    public List<PricingRule> getPricingRuleListByIds(List<String> ids) {
        return iPricingRuleService.list(new QueryWrapper<PricingRule>().in("pricing_id", ids));
    }

    public void updatePricingRule(PricingRule pricingRule) {
        iPricingRuleService.updateById(pricingRule);
    }

    public void deletePricingRule(List<String> ids) {
        iPricingRuleService.removeBatchByIds(ids);
    }
}
